<template>
    <div class="record">
        <van-nav-bar :title="title" left-text="返回" left-arrow @click-left="onClickLeft" />
        <div class="recordList">
            <div class="recordUl" v-show="flat">
                <recordItem :newsList="item" v-for="item in newsList"></recordItem>
            </div>
            <div class="empty" v-show="!flat">
                <van-empty :description="'暂无' + title" />
            </div>
        </div>
    </div>
</template>
<script setup>
import recordItem from "@/components/recordItem.vue";
import { NavBar } from "vant";
import { useRouter, useRoute } from "vue-router";
import { computed, ref, onMounted, defineComponent } from "vue";
let initCom = defineComponent({ recordItem });
const onClickLeft = () => history.back();
const route = useRoute();
let newsList = ref([]);
let title = ref("");
let flat = ref(true);
onMounted(() => {
    newsList.value = JSON.parse(route.query.record);
    // console.log(JSON.parse(route.query.record));
    if (newsList.value.length == 0) {
        flat = false;
    }
    if (route.query.kind == "userComList") {
        title.value = "评论记录";
    } else if (route.query.kind == "userWebList") {
        title.value = "浏览记录";
    } else if (route.query.kind == "userLikeList") {
        title.value = "点赞记录";
    }
    // console.log(route.query);
});
</script>
<style lang="scss">
.recordList {
    padding: 0 10px 50px;
}
.van-nav-bar__text {
    color: #576574;
}
.van-nav-bar .van-icon {
    color: #576574;
}
.empty {
    margin-top: 100px;
}
</style>
